﻿//using System;
//using System.Net;
//using System.Windows;
//using System.Windows.Controls;
//using System.Windows.Documents;
//using System.Windows.Ink;
//using System.Windows.Input;
//using System.Windows.Media;
//using System.Windows.Media.Animation;
//using System.Windows.Shapes;
//using System.Windows.Interactivity;
//using nRoute.Utilities;

//namespace nRoute.Components
//{
//    public partial class DependencyParameterCollection
//        : IAttachedObject
//    {
//        private const string DEPENDENCYOBJECT_CAN_ATTACHEDONCE = "DependencyObject can only be attached once";
//        private const string DEPENDENCYOBJECT_MUSTBE_FRAMEWORK = "Attached DependencyObject must be FrameworkElement derivative";

//        private FrameworkElement _associatedObject;

//#region IAttachedObject related

//        DependencyObject IAttachedObject.AssociatedObject
//        {
//            get { return _associatedObject; }
//        }

//        void IAttachedObject.Attach(DependencyObject dependencyObject)
//        {
//            Guard.ArgumentNotNull(dependencyObject, "dependencyObject");
//            Guard.ArgumentValue(_associatedObject != null, "dependencyObject", DEPENDENCYOBJECT_CAN_ATTACHEDONCE);
//            Guard.ArgumentIsType(dependencyObject, typeof(FrameworkElement), "dependencyObject");

//            _associatedObject = (FrameworkElement)dependencyObject;
//            this.OnAttached();
//        }

//        void IAttachedObject.Detach()
//        {
//            this.OnDetaching();
//            _associatedObject = null;
//        }

//#endregion
        
//#region Overridable

//        protected virtual void ItemAdded(DependencyParameter item)
//        {
//            if (_associatedObject != null)
//            {
//                ((IAttachedObject)_associatedObject).Attach(_associatedObject);
//            }
//        }

//        protected virtual void ItemRemoved(DependencyParameter item)
//        {
//            if (_associatedObject != null)
//            {
//                ((IAttachedObject)_associatedObject).Detach();
//            }
//        }

//        protected virtual void OnAttached() 
//        {
//            foreach (IAttachedObject _parameter in this)
//            {
//                _parameter.Attach(_associatedObject);
//            }
//        }

//        protected virtual void OnDetaching() 
//        {
//            foreach (IAttachedObject _parameter in this)
//            {
//                _parameter.Detach();
//            }
//        }

//#endregion

//    }
//}
